#include <iostream>
#include<vector>
#include<functional>
#include <queue>
#include <string>
#include <stack>

using namespace std;

namespace bit
{
    template <class T, class Container = vector<T>, class Compare = less<T> >
    class priority_queue
    {
    public:

        priority_queue():c(Container()),comp(Compare())
        {}

        template <class InputIterator>
        priority_queue(InputIterator first, InputIterator last)
        {
            while (first != last)
            {
                c.push_back(first);
                first++;
            }
            sort(c.begin(), c.end(), comp());
        }

        bool empty() const
        {
            return c.empty();
        }

        size_t size() const
        {
            return c.size();
        }

        T& top() const;

        void push(const T& x)
        {
            c.push_back(x);
            sort(c.begin(), c.end(), comp());
        }

        void pop()
        {
            swap(c.begin(), c.end());
            c.pop_back();
            sort(c.begin(), c.end(), comp());
        }

    private:

        Container c;
        Compare comp;
    };

};

int main() {
    string str;
    cin >> str;
    stack<string>  ret;
    int i = 0;
    int n = str.size();
    int max_num = 0;
    int p = 0;
    while (i < n)
    {
        string s;
        int k = 0;
        while (i < n && (str[i] <= '9' && str[i] >= '0'))
        {
            s += str[i++];
            k++;
        }
        if (max_num < k)
        {
            max_num = k;
            ret.push(s);
        }
        i++;
    }
    if (max_num != 0)
    {
        cout << ret.top() << endl;
    }
    return 0;
}

class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers) {
        // write code here
        int n = numbers[0];
        int k = 0;
        for (auto s : numbers)
        {
            if (n == s)
            {
                k++;
            }
            else
            {
                k--;
            }
            if (k == 0)
            {
                n = s;
                k++;
            }
        }
        return n;
    }
};